package com.song.shop.service.impl;

import com.song.shop.dao.ShopDao;
import com.song.shop.entity.Shop;
import com.song.shop.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Song Yinghui
 * @date 2018/12/28
 * @Version 1.0
 */
@Service
public class TestServiceImpl implements TestService {

    @Autowired
    private ShopDao shopDao;

    @Override
    //@Transactional
    public void insertRollBackTest(Shop shop) {
        shop.setId("0000000010");
        shopDao.insertShop(shop);
        testRollBack();
    }

    //@Transactional
    public void testRollBack() {
        Shop shop1 = new Shop();
        shopDao.insertShop(shop1);
    }
}
